﻿using DocumentFormat.OpenXml.Office2010.Excel;
using ERP.ERPSystem.WarehouseManagement;
using ERP.ERPSystem.WarehouseManagement.Dto;
using ERP.Team.WarehouseManagement;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace ERP.Web.Controllers.WarehouseManagement
{
    /// <summary>
    /// 仓储管理-库存盘点-xzc
    /// </summary>
    public class InventoryCountsController : Controller
    {
        private readonly IInventoryCountsServices _inventorycountsservices;

        public InventoryCountsController(IInventoryCountsServices inventorycountsservices)
        {
            _inventorycountsservices = inventorycountsservices;
        }
        /// <summary>
        /// 库存盘点视图
        /// </summary>
        /// <returns></returns>
        public IActionResult InventoryView()
        {
            return View();
        }
        /// <summary>
        /// 新增库存盘点视图
        /// </summary>
        /// <returns></returns>
        public IActionResult AddInventoryView()
        {
            return View();
        }
        /// <summary>
        /// 更新库存盘点视图
        /// </summary>
        /// <returns></returns>
        public IActionResult UpdateInventoryView()
        {
            return View();
        }
        /// <summary>
        /// 新增库存盘点
        /// </summary>
        /// <param name="inventorycountsDto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> AddInventoryCounts(InventoryCountsDto inventorycountsDto)
        {
            var i = await _inventorycountsservices.AddInventoryCounts(inventorycountsDto);
            return i;
        }
        /// <summary>
        /// 更改库存盘点
        /// </summary>
        /// <param name="inventorycountsDto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdateInventoryCounts(InventoryCountsDto inventorycountsDto)
        {
            var i = await _inventorycountsservices.UpdateInventoryCounts(inventorycountsDto);
            return i;
        }
        /// <summary>
        /// 通过id查询到相对应的库存盘点
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<InventoryCounts>> FindInventoryCounts(int id)
        {
            var i = await _inventorycountsservices.FindInventoryCounts(id);
            return i;
        }
        /// <summary>
        /// 删除库存盘点
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task DeletedInventoryCounts(int id)
        {
            await _inventorycountsservices.DeletedInventoryCounts(id);
        }
        /// <summary>
        /// 查询库存盘点
        /// </summary>
        /// <param name="getinventorycountsdto"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<InventoryCounts>> GetInventoryCounts(GetInventoryCountsDto getinventorycountsdto)
        {
            var i = await _inventorycountsservices.GetInventoryCounts(getinventorycountsdto);
            return i;
        }
    }
}
